<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="img/favicon.html">

    <title><%= basicFacts.name %> -- 首页</title>

    <!-- Bootstrap core CSS -->
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="/assets/font-awesome//css/font-awesome.css" rel="stylesheet" />
    <link href="/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="stylesheet" href="/css/owl.carousel.css" type="text/css">
    <!-- Custom styles for this template -->
    <link href="/css/style.css" rel="stylesheet">
      <link href="/css/style-responsive.css" rel="stylesheet" />
      <link href="/css/index.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="/js/html5shiv.js"></script>
      <script src="/js/respond.min.js"></script>
    <![endif]-->
      <script src="/js/jquery.js"></script>
  </head>

  <body>

  <section id="container" class="">
      <!--header start-->
      <% include header.html %>
      <!--header end-->
      <!--sidebar start-->
      <% include aside.html %>
      <!--sidebar end-->
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <div class="panel">
                  <header class="panel-heading">背景设置</header>
                  <div class="wrapper_box">
                      <div class="table">
                          <div class="table_cell">
                              <form action="/admin/index/upload" method="post" enctype="multipart/form-data">
                                  <p class="img_box">
                                      <input type="file" name="file" id="file" accept=".png" />
                                  </p>
                                  <div class="panel-body"><button class="btn btn-shadow btn-success">&nbsp;&nbsp;&nbsp;&nbsp;更换背景&nbsp;&nbsp;&nbsp;&nbsp;</button></div>
                              </form>
                          </div>
                      </div>
                  </div>
              </div>

          </section>
      </section>
      <!--main content end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="/js/jquery.js"></script>
    <script src="/js/jquery-1.8.3.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/jquery.scrollTo.min.js"></script>
    <script src="/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="/js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="/js/owl.carousel.js" ></script>
    <script src="/js/jquery.customSelect.min.js" ></script>

    <!--common script for all pages-->
    <script src="/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="/js/sparkline-chart.js"></script>
    <script src="/js/easy-pie-chart.js"></script>

  <script>
      document.getElementById('file').onchange = function(evt) {

          // 如果浏览器不支持FileReader，则不处理

          if (!window.FileReader) return;

          var files = evt.target.files;

          for (var i = 0, f; f = files[i]; i++) {

              if (!f.type.match('image.*')) {

                  continue;

              }


              var reader = new FileReader();

              reader.onload = (function(theFile) {

                  return function(e) {

                      // img 元素

//                      document.getElementById('previewImage').src = e.target.result;

                      $('.img_box').css('background-image', 'url('+ e.target.result +')');

                  };

              })(f);


              reader.readAsDataURL(f);

          }

      }
  </script>

  </body>
</html>
